<template>
	<!-- 物料审批列表（采购） -->
	<view class="content">
	  <view class="container">
	     <!-- 正文内容 -->  
	  	   <view class="content2">
	  		   <view   v-for="(item,index) in dataList" :key="index">
	  		   <view class="item">
	  				 <view class="item-content" @click="myApply(item.purchasingmaterialsid)">
	  					  <view class="item-content-item">
	  						  {{item.applicationtime}}
	  						  <view style=" margin-left: 25%; " >{{item.procureapproval}}</view>
	  					  </view>
	  					  <view class="item-content-item">
	  						  <view class="item-content-item-left">物料:</view>
	  						  <view class="item-content-item-right">
	  							  {{item.materialname}} 
	  						  </view>
	  					  </view>
	  					  <view class="item-content-item">
	  						  <view class="item-content-item-left">单号:</view>
	  						  <view class="item-content-item-right">
	  							  {{item.workordernumber}} 
	  						  </view>
	  					  </view>
	  				 </view>
	  			 </view>
	  		  </view>
				 <!--   数据 为空时  -->
				 <template v-if="empty==0">
					<u-empty
						textSize = '15'
						mode = "data"
						icon = "http://121.5.128.59:9000/picture/cbbd3de693b44e84afe2593f449acbb6.png"
					>
					</u-empty>
				 </template>
	  		</view>	
	  </view>
	  
	  
	</view>
</template>

<script>
	export default{
	  data(){
	    return{
			dataList:[],
			empty: 0,
	    }
	  },
		onLoad() {
			this.dataList = []
			uni.request({
				url: "https://www.smacaftersales.com:443/afterSalesPurchasingMaterials/afterSalesPurchasingMaterials/findMaterialsByPickingStatus",
				method: 'GET',
				success: (res) => {
					console.log(res,"------**-")
					if (res.data.data.length != 0) {
						this.empty = 1
						for (var i = 0; i < res.data.data.length; i++) {
							this.dataList.push(res.data.data[i])
						}
					} else{
						this.empty = 0
					}
				}
			})
		},
		onShow() {},
		onUnload() {  //监听页面卸载
			uni.switchTab({
				url: '/pages/adminVue/my'
			})
		},
	  methods:{
			// 详情 页 
			myApply(purchasingmaterialsid){
				let purchasingmaterialsid2 = purchasingmaterialsid
			    let	data2 = { msg: purchasingmaterialsid2 } 
				uni.navigateTo({
					url: '/pages/adminVue/examineApproveProcure?data='+encodeURIComponent(JSON.stringify(data2))
				})
			}, 
	  },
	  onPullDownRefresh(){
			this.dataList = []
			uni.request({
				url: "https://www.smacaftersales.com:443/afterSalesPurchasingMaterials/afterSalesPurchasingMaterials/findMaterialsByPickingStatus",
				method: 'GET',
				success: (res) => {
					console.log(res,"------**-")
					if (res.data.data.length != 0) {
						this.empty = 1
						for (var i = 0; i < res.data.data.length; i++) {
							this.dataList.push(res.data.data[i])
						}
					} else{
						this.empty = 0
					}
				}
			})
			uni.stopPullDownRefresh() // 终止刷新 
	  }
	}
	
</script>

<style scoped lang="scss">
	.container{
			display: flex;
			flex-direction: column;
			height: calc(100vh - var(--window-top));
			width: 100%;
			.slot-wrap{
				display: flex;
				align-items: center;
				flex: 1;
				.search-wrap{
					margin: 0 20rpx;
					flex: 1;
				}
			}
			.content2{
				flex:1;
				.item{
					height: 200rpx;
					margin-left: 49rpx;
					margin-top:15rpx;
					margin-right:49rpx;
					border-radius: 15rpx;
					background-color:#FFFF;
					.item-top{
						padding-left: 52rpx;
						padding-right: 52rpx;
						padding-top: 48rpx;
						display: flex;
						justify-content: space-between;
						align-items: center;
						.item-top-left{
							font-size: 44rpx;
						}
						.item-top-right {
							font-size: 44rpx;
						}
					}
					.item-content{
						height: 200rpx;
						border-bottom:1rpx solid #e8e8e8 ;
						background-color: #FFFFFF;
						.item-content-item{
							color: #777777;
							padding-left: 52rpx;
							padding-top: 20rpx;
							font-size:32rpx ;
							display:flex;
							flex-direction: row;
							.item-content-item-left{
								color:#8b8b8b;
								padding-right: 35rpx;
							}
							.item-content-item-right{
								color:#1b286e;
							}
						}
						
					}
					.item-btn{
						height: 30rpx;
						font-size: 36rpx;
						padding-top: 20rpx;
						padding-left: 52rpx;
						background-color: #FFFFFF;
						display: flex;
						justify-content: space-between;
						align-items: center;
						.item-btn-right{
							width: 20px;
							height: 20px;
							margin-right: 50rpx;
							color:#e8e8e8;
						}
					}
				}
			}
		}
	/* /// */
  .head-nav{
    width: 50%;
    margin:20rpx auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  .activite{
    font-weight: bold;
    border-bottom: 6rpx solid #0065d9;
	color: #0065d9;
  }
  .head-nav>view{
    padding-bottom: 10rpx;
  }
  .box{background: #008000;}
</style>